package com.patzn.osgi.blueprint.hello;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.container.Converter;
import org.osgi.service.blueprint.container.ReifiedType;

/**
 * @name: BlueprintEnv
 * @description: BlueprintEnv
 * @author: jiangcs
 */
public class BlueprintEnv {
    private BundleContext bundleContext;
    private Bundle bundle;
    private BlueprintContainer blueprintContainer;
    private Converter converter;

    public void init() throws Exception {
        System.out.println(bundleContext.getBundle().getSymbolicName());
        System.out.println(bundle.getSymbolicName());
        System.out.println(blueprintContainer.getComponentIds().size());
        System.out.println(converter.convert(123, new ReifiedType(Integer.class)));
    }

    public BundleContext getBundleContext() {
        return bundleContext;
    }

    public void setBundleContext(BundleContext bundleContext) {
        this.bundleContext = bundleContext;
    }

    public Bundle getBundle() {
        return bundle;
    }

    public void setBundle(Bundle bundle) {
        this.bundle = bundle;
    }

    public BlueprintContainer getBlueprintContainer() {
        return blueprintContainer;
    }

    public void setBlueprintContainer(BlueprintContainer blueprintContainer) {
        this.blueprintContainer = blueprintContainer;
    }

    public Converter getConverter() {
        return converter;
    }

    public void setConverter(Converter converter) {
        this.converter = converter;
    }
}
